using System;
using System.Collections.Generic;

namespace WCS.Infrastructure.Dto.Response.Ai
{
    /// <summary>
    /// 文件说明：AI 对话响应数据
    /// 作用：最小化兼容混元返回的结构，供前端消费
    /// 作者：系统自动生成
    /// 日期：2025-11-19
    /// </summary>
    public class ChatResponseDto
    {
        /// <summary>
        /// 响应 ID
        /// </summary>
        public string? id { get; set; }

        /// <summary>
        /// 模型名称
        /// </summary>
        public string? model { get; set; }

        /// <summary>
        /// 创建时间（Unix 秒）
        /// </summary>
        public long? created { get; set; }

        /// <summary>
        /// 生成结果列表
        /// </summary>
        public List<ChatChoiceDto> choices { get; set; } = new List<ChatChoiceDto>();

        /// <summary>
        /// token 用量
        /// </summary>
        public UsageDto? usage { get; set; }
    }

    /// <summary>
    /// 单条生成结果
    /// </summary>
    public class ChatChoiceDto
    {
        /// <summary>
        /// 结果消息
        /// </summary>
        public ChatMessageDto? message { get; set; }
    }

    /// <summary>
    /// 返回消息（与请求格式一致）
    /// </summary>
    public class ChatMessageDto
    {
        /// <summary>
        /// 角色
        /// </summary>
        public string? role { get; set; }

        /// <summary>
        /// 文本内容
        /// </summary>
        public string? content { get; set; }
    }

    /// <summary>
    /// token 用量
    /// </summary>
    public class UsageDto
    {
        /// <summary>
        /// 提示 token 数
        /// </summary>
        public int? prompt_tokens { get; set; }

        /// <summary>
        /// 生成 token 数
        /// </summary>
        public int? completion_tokens { get; set; }

        /// <summary>
        /// 总 token 数
        /// </summary>
        public int? total_tokens { get; set; }
    }
}